type SearchDataInterface = {
  query: string;
  keyword_result: string;
  graph_keyword: string[];
  type: number;
  signal: AbortSignal;
};
export async function search(data: SearchDataInterface) {
  const { query, keyword_result, graph_keyword, type, signal } = data;
  const response = await fetch(window.call_llm_url, {
    method: "post",
    signal: signal,
    headers: { "content-type": "application/json" },
    body: JSON.stringify({
      query,
      keyword_result,
      graph_keyword,
      type,
    }),
  }).catch((err) => {
    console.error(err);
    return null;
  });

  return response;
}
